using System;
using System.Collections.Generic;

using SMSSender.Entities.Utils;
using SMSSender.Entities.Models;
using SMSSender.DAL;
using SMSSender.Common;

namespace SMSSender.Biz
{
	public class CustomerService
	{
		/// <summary>
		/// Saves a record to the Customer table.
		/// </summary>
		public virtual void Insert(CustomerInfo customerInfo)
		{
			try
			{
				new CustomerDAO().Insert(customerInfo);
			}
			catch (Exception ex)
			{
				Logger.Error("SMSSender.Biz.Customer - Insert", ex);
				throw;
			}

		}

		/// <summary>
		/// Saves a record to the Customer table.
		/// </summary>
		public virtual void Update(CustomerInfo customerInfo)
		{
			try
			{
				new CustomerDAO().Update(customerInfo);
			}
			catch (Exception ex)
			{
				Logger.Error("SMSSender.Biz.Customer - Update", ex);
				throw;
			}

		}

		/// <summary>
		/// Delete a record from the Customer table.
		/// </summary>
		public virtual void Delete(string idPhone)
		{
			try
			{
				new CustomerDAO().Delete(idPhone);
			}
			catch (Exception ex)
			{
				Logger.Error("SMSSender.Biz.Customer - Delete", ex);
				throw;
			}

		}

		/// <summary>
		/// Selects a single record from the Customer table.
		/// </summary>
		public virtual CustomerInfo Select(string idPhone)
		{
			try
			{
				return new CustomerDAO().Select(idPhone);
			}
			catch (Exception ex)
			{
				Logger.Error("SMSSender.Biz.Customer - Select", ex);
				throw;
			}

		}

		/// <summary>
		/// Selects all records from the Customer table.
		/// </summary>
		public List<CustomerInfo> SelectAll()
		{
			try
			{
				return new CustomerDAO().SelectAll();
			}
			catch (Exception ex)
			{
				Logger.Error("SMSSender.Biz.Customer - SelectAll", ex);
				throw;
			}

		}

	}
}
